const BaseController = require('./baseController')

class StorythemeController extends BaseController {
  get modelName () {
    return 'Storytheme'
  }

  async getByCategoryId () {
    const { ctx } = this
    const { _id: categoryId } = ctx.params
    console.log('categoryId========', categoryId)
    let rz = await ctx.model[this.modelName].find({ categoryId }).lean()
    ctx.body = {
      items: rz
    }
    return rz
  }

  async findTheme () {
    const { ctx } = this
    const { _id } = ctx.params
    let rz = await ctx.model[this.modelName].findById(_id)
    ctx.body = rz
    return rz
  }
}

module.exports = StorythemeController
